package com.starsoft.frame.base.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.starsoft.frame.base.bean.BaseFlexsetData;
import com.starsoft.frame.core.orm.BaseDao;

@Repository
public class FlexsetDataDao extends BaseDao<BaseFlexsetData, Integer> {

	public List<BaseFlexsetData> getExFlexsetData(String flexCode, String exsystem) {
		String hql = "from BaseFlexsetData where flexsetCode=?0  and exsystem=?1";
		return this.find(hql, flexCode, exsystem);
	}

	public List<BaseFlexsetData> getFlexsetData(String flexsetCode) {
		String hql = "from BaseFlexsetData where flexsetCode=?0 and exsystem is null";
		return this.find(hql, flexsetCode);
	}

	public String getFlexsetValue(String flexsetCode, String code) {
		String hql = "from BaseFlexsetData where flexsetCode=?0 and code=?1 and exsystem is null";
		BaseFlexsetData flexData = (BaseFlexsetData) get(hql, flexsetCode, code);
		if (flexData != null) {
			return flexData.getName();
		} else {
			return null;
		}
	}

}
